/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrontOperatorFrame.java
 *
 * Created on 2011-11-3, 0:50:22
 */
package view.frontoperator;

import business.LogoutCmd;
import javax.swing.JOptionPane;
import view.LoginFrame;

/**
 *
 * @author Administrator
 */
public class FrontOperatorFrame extends javax.swing.JFrame {

    /** Creates new form FrontOperatorFrame */
    public FrontOperatorFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonPanel = new javax.swing.JPanel();
        OpenAccountBtn = new javax.swing.JButton();
        DepositBtn = new javax.swing.JButton();
        DrawBtn = new javax.swing.JButton();
        QueryBtn = new javax.swing.JButton();
        TransferBtn = new javax.swing.JButton();
        ModifyPwdBtn = new javax.swing.JButton();
        DelAccBtn = new javax.swing.JButton();
        CreateNewCusBtn = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        line = new javax.swing.JSeparator();
        contentPanel = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        buttonPanel.setName("buttonPanel"); // NOI18N

        OpenAccountBtn.setText("开户");
        OpenAccountBtn.setName("OpenAccountBtn"); // NOI18N
        OpenAccountBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                OpenAccountBtnActionPerformed(evt);
            }
        });

        DepositBtn.setText("存款");
        DepositBtn.setName("DepositBtn"); // NOI18N
        DepositBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DepositBtnActionPerformed(evt);
            }
        });

        DrawBtn.setText("取款");
        DrawBtn.setName("DrawBtn"); // NOI18N
        DrawBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DrawBtnActionPerformed(evt);
            }
        });

        QueryBtn.setText("查询");
        QueryBtn.setName("QueryBtn"); // NOI18N
        QueryBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                QueryBtnActionPerformed(evt);
            }
        });

        TransferBtn.setText("转账");
        TransferBtn.setName("TransferBtn"); // NOI18N
        TransferBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TransferBtnActionPerformed(evt);
            }
        });

        ModifyPwdBtn.setText("改密码");
        ModifyPwdBtn.setName("ModifyPwdBtn"); // NOI18N
        ModifyPwdBtn.setPreferredSize(new java.awt.Dimension(57, 23));
        ModifyPwdBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ModifyPwdBtnActionPerformed(evt);
            }
        });

        DelAccBtn.setText("销户");
        DelAccBtn.setName("DelAccBtn"); // NOI18N
        DelAccBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DelAccBtnActionPerformed(evt);
            }
        });

        CreateNewCusBtn.setText("新客户");
        CreateNewCusBtn.setName("CreateNewCusBtn"); // NOI18N
        CreateNewCusBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CreateNewCusBtnActionPerformed(evt);
            }
        });

        jButton1.setText("查看报表");
        jButton1.setName("jButton1"); // NOI18N

        jButton2.setText("登出");
        jButton2.setName("jButton2"); // NOI18N
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout buttonPanelLayout = new javax.swing.GroupLayout(buttonPanel);
        buttonPanel.setLayout(buttonPanelLayout);
        buttonPanelLayout.setHorizontalGroup(
            buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(buttonPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(CreateNewCusBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)
                    .addComponent(OpenAccountBtn, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)
                    .addComponent(DepositBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)
                    .addComponent(DrawBtn, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)
                    .addComponent(QueryBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)
                    .addComponent(TransferBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ModifyPwdBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(DelAccBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE))
                .addContainerGap())
        );
        buttonPanelLayout.setVerticalGroup(
            buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(buttonPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(CreateNewCusBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(OpenAccountBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(DepositBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(DrawBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(QueryBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(TransferBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ModifyPwdBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(DelAccBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 73, Short.MAX_VALUE)
                .addComponent(jButton2)
                .addContainerGap())
        );

        line.setOrientation(javax.swing.SwingConstants.VERTICAL);
        line.setName("line"); // NOI18N

        contentPanel.setName("contentPanel"); // NOI18N
        contentPanel.setLayout(new javax.swing.BoxLayout(contentPanel, javax.swing.BoxLayout.LINE_AXIS));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(buttonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(10, 10, 10)
                .addComponent(line, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(contentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 572, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(contentPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE)
                    .addComponent(buttonPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(line, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void CreateNewCusBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateNewCusBtnActionPerformed
        this.contentPanel.removeAll();
        CreateNewCusPanel p = new CreateNewCusPanel();        
        this.contentPanel.add(p); 
        p.setVisible(true);
        this.contentPanel.validate();
    }//GEN-LAST:event_CreateNewCusBtnActionPerformed

    private void OpenAccountBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OpenAccountBtnActionPerformed
        this.contentPanel.removeAll();
        CreateNewAccPanel p = new CreateNewAccPanel();        
        this.contentPanel.add(p); 
        p.setVisible(true);
        this.contentPanel.validate();
    }//GEN-LAST:event_OpenAccountBtnActionPerformed

    private void DepositBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DepositBtnActionPerformed
        this.contentPanel.removeAll();
        DepositPanel p = new DepositPanel();        
        this.contentPanel.add(p); 
        p.setVisible(true);
        this.contentPanel.validate();
    }//GEN-LAST:event_DepositBtnActionPerformed

    private void DrawBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DrawBtnActionPerformed
        this.contentPanel.removeAll();
        DrawPanel p = new DrawPanel();        
        this.contentPanel.add(p); 
        p.setVisible(true);
        this.contentPanel.validate();
    }//GEN-LAST:event_DrawBtnActionPerformed

    private void QueryBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_QueryBtnActionPerformed
        this.contentPanel.removeAll();
        QueryPanel p = new QueryPanel();        
        this.contentPanel.add(p); 
        p.setVisible(true);
        this.contentPanel.validate();
    }//GEN-LAST:event_QueryBtnActionPerformed

    private void TransferBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TransferBtnActionPerformed
        this.contentPanel.removeAll();
        TransferPanel p = new TransferPanel();        
        this.contentPanel.add(p); 
        p.setVisible(true);
        this.contentPanel.validate();
    }//GEN-LAST:event_TransferBtnActionPerformed

    private void ModifyPwdBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ModifyPwdBtnActionPerformed
        this.contentPanel.removeAll();
        ModifyPwdPanel p = new ModifyPwdPanel();        
        this.contentPanel.add(p); 
        p.setVisible(true);
        this.contentPanel.validate();
    }//GEN-LAST:event_ModifyPwdBtnActionPerformed

    private void DelAccBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DelAccBtnActionPerformed
        this.contentPanel.removeAll();
        DelAccPanel p = new DelAccPanel();        
        this.contentPanel.add(p); 
        p.setVisible(true);
        this.contentPanel.validate();
    }//GEN-LAST:event_DelAccBtnActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        LogoutCmd cmd = new LogoutCmd();
        if( cmd.execute(null) ) {
            new LoginFrame().setVisible(true);
            this.dispose();
        }else{
            JOptionPane.showMessageDialog(this, "登出失败 ", "错误", JOptionPane.ERROR_MESSAGE);
        }        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrontOperatorFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrontOperatorFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrontOperatorFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrontOperatorFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FrontOperatorFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton CreateNewCusBtn;
    private javax.swing.JButton DelAccBtn;
    private javax.swing.JButton DepositBtn;
    private javax.swing.JButton DrawBtn;
    private javax.swing.JButton ModifyPwdBtn;
    private javax.swing.JButton OpenAccountBtn;
    private javax.swing.JButton QueryBtn;
    private javax.swing.JButton TransferBtn;
    private javax.swing.JPanel buttonPanel;
    private javax.swing.JPanel contentPanel;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JSeparator line;
    // End of variables declaration//GEN-END:variables
}
